/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */




import weka.core.Instances;
import weka.core.Attribute;

import java.util.Random;
import java.io.*;
import java.util.ArrayList;
import weka.classifiers.trees.tdit.TDIDTTree;
import weka.classifiers.trees.tdit.Criteria;


/**
 *
 * @author mgomez
 */

public class RandomCriteria implements Criteria, Serializable{

    /**
     * Metodo de seleccion de siguiente variable
     */
    public Attribute getNext(Instances data, ArrayList<Attribute> unused){
        Random random = new Random();
        Attribute selected = null;

        // Se selecciona aleatoriamente un indice de atributo
        int index = random.nextInt(unused.size());

        // Gets the selected attribute
        selected = unused.get(index);
        
        // Se devuelve el seleccionado
        return selected;
    }
}
 


                
 
